/**
 * Copyright (C) 2022-2023
 * All rights reserved, Designed By www.tonetn.com
 * 注意：
 * 本软件为www.tonetn.com开发研制，未经购买不得使用
 * 购买后可获得全部源代码（禁止转卖、分享、上传到码云、github等开源平台）
 * 一经发现盗用、分享等行为，将追究法律责任，后果自负
 */
package com.xunyin.modules.goods.service.mapper;

import com.xunyin.common.mapper.CoreMapper;
import com.xunyin.modules.goods.domain.TGoods;
import com.xunyin.modules.goods.vo.GoodsInfoVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * @author admin
 * @date 2022-10-28
 */
@Repository
public interface TGoodsMapper extends CoreMapper<TGoods> {

    /**
     * 根据 linkId 获取茶室柜台商品信息
     */
    @Select("select rg.id,rg.main_id mainId,rg.tea_house_id teaHouseId,rg.tea_room_id teaRoomId, " +
            " rg.goods_id goodsId,rg.container_num containerNum,rg.price,rg.stock,rg.publish_status publishStatus," +
            " rg.status,g.goods_name goodsName,g.goods_detail goodsDetail,g.images,g.brand,g.category_name categoryName," +
            " g.size_desc sizeDesc,g.is_discount isDiscount" +
            " from t_tea_room_container_goods_link rg  " +
            " INNER JOIN t_goods g on rg.goods_id=g.id " +
            " where rg.id=#{goodsLinkId} and rg.status=1 and g.status=1")
    GoodsInfoVo getGoodsInfoByLinkId(@Param("goodsLinkId") Integer goodsLinkId);

}
